package com.cbg.controller;

import com.cbg.po.TbItem;
import com.cbg.pojo.EUDataGridResult;
import com.cbg.service.inter.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by chenboge on 2017/3/16.
 */
@RequestMapping(value = "/item")
@Controller
public class ItemController {

    @Autowired
    private ItemService itemService;

    @ResponseBody
    @RequestMapping("/list")
    public List<TbItem> queryAll(@RequestParam("page") Integer page, @RequestParam("pagesize") Integer pagesize) {
        EUDataGridResult result = itemService.queryItems(page, pagesize);
        return (List<TbItem>) result.getRows();
    }

}
